/*
package com.ruoyi.rabbitmq;

import org.springframework.amqp.core.*;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitMQConfig {

    @Value("${app.rabbitmq.queue}")
    private String queueName;

    @Value("${app.rabbitmq.exchange}")
    private String exchangeName;

    @Value("${app.rabbitmq.routing-key}")
    private String routingKey;

    // 创建队列
    @Bean
    public Queue simpleQueue() {
        return new Queue(queueName, true); // true表示持久化
    }

    // 创建直连交换机
    @Bean
    public DirectExchange directExchange() {
        return new DirectExchange(exchangeName, true, false);
    }

    // 绑定队列到交换机
    @Bean
    public Binding binding(Queue simpleQueue, DirectExchange directExchange) {
        return BindingBuilder.bind(simpleQueue)
                .to(directExchange)
                .with(routingKey);
    }

    // JSON消息转换器
    @Bean
    public MessageConverter jsonMessageConverter() {
        return new Jackson2JsonMessageConverter();
    }
}
*/
